package com.xinzhidi.web.house.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xinzhidi.web.build.domain.CBuild;
import com.xinzhidi.web.house.domain.Household;
import com.xinzhidi.web.house.domain.dto.HouseholdListDto;
import com.xinzhidi.web.house.domain.vo.HouseholdInfoVo;
import com.xinzhidi.web.house.domain.vo.HouseholdListVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;


/**
 * 住户Mapper接口
 *
 * @author cx
 * @date 2023-05-23
 */
public interface HouseholdMapper extends BaseMapper<Household> {
    /**
     * 查询住户
     *
     * @param id 住户主键
     * @return 住户
     */
    public Household selectHouseholdById(Long id);

    /**
     * 查询住户列表
     *
     * @param household 住户
     * @return 住户集合
     */
    public List<Household> selectHouseholdList(Household household);

    /**
     * 新增住户
     *
     * @param household 住户
     * @return 结果
     */
    public int insertHousehold(Household household);

    /**
     * 修改住户
     *
     * @param household 住户
     * @return 结果
     */
    public int updateHousehold(Household household);

    /**
     * 删除住户
     *
     * @param id 住户主键
     * @return 结果
     */
    public int deleteHouseholdById(Long id);

    /**
     * 批量删除住户
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteHouseholdByIds(Long[] ids);

    /**
     * 批量删除楼栋
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteCBuildByIds(Long[] ids);

    /**
     * 批量新增楼栋
     *
     * @param cBuildList 楼栋列表
     * @return 结果
     */
    public int batchCBuild(List<CBuild> cBuildList);


    /**
     * 通过住户主键删除楼栋信息
     *
     * @param id 住户ID
     * @return 结果
     */
    public int deleteCBuildById(Long id);

    List<HouseholdListVo> selectHouseholdListVo(@Param("dto")HouseholdListDto dto, @Param("list")List<Long> userPlotIds);

    /**
     * 通过住户Id查询住户详情信息
     *
     * @param id 住户ID
     * @return 结果
     */
    HouseholdInfoVo selectHouseholdInfo(Long id);

    /**
     * 通过住户Id查询住户详情信息
     *
     * @param buildId 楼栋ID
     * @param uniId 单元ID
     * @return 结果
     */
    int updateTotalHouseNum(@Param("buildId")Long buildId,@Param("uniId")Long uniId);

    /**
     * 根据模型id集合及协议类型获取住户id集合
     *
     * @param modelIds 模型id集合
     * @param protocolType 协议类型
     * @return 结果
     */
    List<Household> getHouseholdIdsByModelIds(List<Integer> modelIds, String protocolType);
}
